home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 44
/
Aminet 44 (2001)(GTI - Schatztruhe)[!][Aug 2001].iso
/
Aminet
/
dev
/
gui
/
gtlayout.lha
/
Source
/
LTP_AdjustItemPosition.c
< prev
next >
Wrap
C/C++ Source or Header
|
1999-01-02
|
1KB
|
59 lines
/*
** GadTools layout toolkit
**
** Copyright © 1993-1999 by Olaf `Olsen' Barthel
** Freely distributable.
**
** :ts=4
*/
#ifndef _GTLAYOUT_GLOBAL_H
#include "gtlayout_global.h"
#endif
#include "Assert.h"
#ifdef DO_MENUS /* Support code */
/* LTP_AdjustItemPosition(struct MenuItem *Item,WORD Left,WORD Top):
*
* Calculate the effective positions of the menu items.
*/
LONG
LTP_AdjustItemPosition(struct MenuItem *Item,LONG Left,LONG Top)
{
ItemNode *Node;
LONG Width = 0;
// Hit the road, Jack...
while(Item)
{
// Get back
Node = (ItemNode *)((ULONG)Item - sizeof(struct MinNode));
// Add up the left edge
Node->Left = Left + Node->Item.LeftEdge;
Node->Top = Top + Node->Item.TopEdge;
// Fix up the sub menu
if(Node->Item.SubItem)
Node->Width = LTP_AdjustItemPosition(Node->Item.SubItem,Node->Left,Node->Top);
// Update the local width
if(Node->Item.LeftEdge + Node->Item.Width > Width)
Width = Node->Item.LeftEdge + Node->Item.Width;
Item = Item->NextItem;
}
return(Width);
}
#endif /* DO_MENUS */